package com.vitabuybuy.tv.network

import com.library.common.net.NetUrl
import com.vitabuybuy.tv.dto.*
import rxhttp.IAwait
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

/**
 * 作者：SimGa
 * 日期：2020/12/3
 * 时间：17:04
 * 包名：com.vitabuybuy.tv.network
 */
object MyCommentRepository {

    fun getCommentList(
        pageNumber: Int,
        pageSize: Int
    ): IAwait<MutableList<MyCommentDto>> {
        val json = mapOf(
            Pair(
                "pageable",
                mapOf(
                    Pair("page", pageNumber),
                    Pair("size", pageSize),
                    Pair("desc", "id")
                )
            )
        )
        return RxHttp.postJson(NetUrl.api_get_my_comment_list).addAll(json).toResponse()
    }

    fun getCommentDetail(
        id: Int?
    ): IAwait<MyCommentDetailDto> {
        val json = mapOf(
            Pair(
                "id",
                id
            )
        )
        return RxHttp.postJson(NetUrl.api_get_my_comment_detail).addAll(json).toResponse()
    }

    fun getDeleteDetail(
        id: Int?
    ): IAwait<String> {
        return RxHttp.postJson(NetUrl.api_delete_evaluation)
            .add("id", id).toResponse()
    }
}